package org.wsjy.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.wsjy.model.PageList;
import org.wsjy.model.TClassroom;
import org.wsjy.service.ClassroomService;

/**
 * 保洁课堂
 *
 * @Title:
 * @Company:万世极缘工作室
 * @Description:
 * @Author:万世极缘
 * @Since:2016年2月19日
 * @Copyright:Copyright (c) 2016
 * @ModifyDate:
 * @Version:1.1.0
 */
@Controller
@RequestMapping("/classroom")
public class ClassroomController {
    @Autowired
    private ClassroomService classroomService;

    @RequestMapping(value = "/classroom_list.asp")
    public String classroomList(ModelMap model, @RequestParam(value = "stSign", required = false) String stSign, @RequestParam(value = "clContent", required = false) String clContent,
            @RequestParam(value = "page", required = false, defaultValue = "1") int page, @RequestParam(value = "pageSize", required = false, defaultValue = "20") int pageSize,
            @RequestParam(value = "sort", required = false, defaultValue = " ORDER BY DT_UPDATE_TIME DESC ") String sort) {
        // 分页查询出数据，在PageList中有page,pageSize,sort,conditionMap等参数
        PageList<TClassroom> classroomPageList = classroomService.findPageList(stSign, clContent, page, pageSize, sort);
        // 查出课堂中总共有哪些标签
        List<String> signList = classroomService.findAllSign();
        // 放入model中
        model.addAttribute("classroomPageList", classroomPageList);
        model.addAttribute("signList", signList);
        return "/classroom/classroom_list";
    }
}
